#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <map>
#include <climits>


using namespace std;

class Solution {
public:
    bool areAlmostEqual(string s1, string s2) {
        int cnt=0,len1=s1.size(),len2=s2.size();
        if(len1!=len2){
            return false;
        }
        int x[len1+5]={0};
        
        for(int i=0;i<len2;i++){
            if(s1[i]!=s2[i]){
                x[cnt++]=i;
            }
            
        }
        if(cnt==0) return true;
        if(cnt>2){
            return false;
        }
        if(s1[x[0]]==s2[x[1]]&&s1[x[1]]==s2[x[0]]){
            return true;
        }
        return false;
    }
};
int main(){

    string ss[2]={
        "abcd","dcba"
    };
    Solution s;
    if(s.areAlmostEqual(ss[0],ss[1])){
         cout << "true"<<endl;
    }else{
        cout << "false" <<endl;
    }
   


    return 0;
}